﻿using System;
using System.Collections.Generic;
using System.Data;
using ReflectionStudio.Core.Events;
using System;
using System.Data;
using System.Windows;
using System.Windows.Data;
using System.ComponentModel;
using System.Windows.Controls;
namespace WPFExcelReport
{
    public partial class UIAPFOLGE : ViewBase
    {
        public void ResetSeq(object sender, RoutedEventArgs e)
        {
            if (!TMV.IsITX)
            {
                return;
            }
        }
        public VAPFOLGE TMV
        {
            get
            {
                return (VAPFOLGE)MV;
            }
        }

        public UIAPFOLGE()
        {

        }

        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            if (IsLoaded)
                return;
            base.Window_Loaded(sender, e);
        }

        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwAPF = dwMaster;
            if (dwMaster == null)
            {
                KEY = "";
                APFZUSTAND = "";
                APFKENNUNG = "  ";
                APFMATABR = " ";
                APFRUECKKZ = " ";
                APFNEGVERF = "";
                APFRZUSA = "";
                APFNEGRGRP = "";
                APFNEGGEW = "";
                APFGEWSCHL = "";
                APFNEGPGRP = "";
                APFNEGBHDLG = "";
                APFNEGBHDLG2 = "";
                APFNEGBHDLG3 = "";
                APFNEGBHDLG4 = "";
                APFNEGFBKL = "";
                APFNEGMERK1 = "";
            }
            else
            {
                KEY = TMV.APFANRKRS + TMV.APFALFDNR + TMV.APFAFOLGE + TMV.APFKSTKRS + TMV.APFKST + TMV.APFAGANG;
                APFRUECKKZ = TMV.APFRUECKKZ;
                APFZUSTAND = TMV.APFZUSTAND;
                APFKENNUNG = TMV.APFKENNUNG;
                APFMATABR = TMV.APFMATABR;
                APFRZUSA = TMV.APFRZUSA;
                APFNEGRGRP = TMV.APFNEGRGRP;
                APFNEGGEW = TMV.APFNEGGEW;
                APFGEWSCHL = TMV.APFGEWSCHL;
                APFNEGPGRP = TMV.APFNEGPGRP;
                APFNEGBHDLG = TMV.APFNEGBHDLG;

                APFNEGBHDLG2 = TMV.APFNEGBHDLG2;
                APFNEGBHDLG3 = TMV.APFNEGBHDLG3;
                APFNEGBHDLG4 = TMV.APFNEGBHDLG4;
                APFNEGFBKL = TMV.APFNEGFBKL;
                APFNEGMERK1 = TMV.APFNEGMERK1;
            }
        }
        public override void LOADBYAUF()
        {
            if (!IsCanLoad)
                return;
            if (ORDERNUM == "")
                return;
            dwData = TBMain.NewRow();
            dwData["APFMANDANT"] = app.Mandant;
            dwData["APFANRKRS"] = " AND APFANRKRS ='" + ORDERNUM.Substring(0, 2) + "'";
            dwData["APFALFDNR"] = " AND APFALFDNR = '" + ORDERNUM.Substring(2, 6) + "'";
            dwData["APFAFOLGE"] = " AND APFAFOLGE = '" + ORDERNUM.Substring(8, 3) + "'";
            SResult = TMV.QAPF09(dwData);
            MergeData(SResult, true);
            base.LOADBYAUF();
        }
        public int NRi = 1;
        public void NR_GotFocus(object sender, RoutedEventArgs e)
        {
            if (dwMaster == null)
                return;
            TextBox control = sender as TextBox;
            if (control.Tag != null)
            {
                NRi = Convert.ToInt16(control.Tag);
            }
        }
        public virtual string HITTEST(Dictionary<string, object> pm)
        {
            HITAPK = "";
            return HITAPK;
        }
        public virtual void SD_GotFocus(object sender, RoutedEventArgs e)
        {
            //NRi = 1;
        }
        public override void SaveCommand(object sender, RoutedEventArgs e)
        {
            if (!IsEdit)
                return;
            foreach (DataRow row in TBMain.Rows)
            {
                TMV.UpdateAPFOLGE(row, app.company, 0);
            }
            base.SaveCommand(sender, e);
        }
        public override void OnSave()
        {
            if (!IsSaved)
                return;
            foreach (DataRow row in TBMain.Rows)
            {
                TMV.UpdateAPFOLGE(row, app.company, 0);
            }
            base.OnSave();
        }
    }
    public partial class UIAPFOLGE
    {

        #region ==APFFERTIG===========
        public static readonly DependencyProperty APFFERTIGProperty = DependencyProperty.Register("APFFERTIG",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFFERTIGChanged));
        public string APFFERTIG
        {
            get
            {
                return (string)GetValue(APFFERTIGProperty);
            }
            set
            {
                SetValue(APFFERTIGProperty, value);
               
            }
        }
        private static void OnAPFFERTIGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFFERTIG = (string)e.NewValue;
                src.OnAPFFERTIGChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFFERTIGChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFFERTIG = value;
        }
        #endregion

        #region ==KST===========
        public static readonly DependencyProperty KSTProperty = DependencyProperty.Register("KST",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnKSTChanged));
        public string KST
        {
            get
            {
                return (string)GetValue(KSTProperty);
            }
            set
            {
                SetValue(KSTProperty, value);
                OnKSTChg(value);
            }
        }
        private static void OnKSTChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.KST = (string)e.NewValue;
            }
        }
        public virtual void OnKSTChg(string value)
        { }
        #endregion  
        
        #region ==IsAutoAPK===========
        public static readonly DependencyProperty IsAutoAPKProperty = DependencyProperty.Register("IsAutoAPK",
            typeof(bool), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsAutoAPKChanged));
        public bool IsAutoAPK
        {
            get
            {
                return (bool)GetValue(IsAutoAPKProperty);
            }
            set
            {
                SetValue(IsAutoAPKProperty, value);
                OnAutoAPKChg();
            }
        }
        private static void OnIsAutoAPKChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.IsAutoAPK = (bool)e.NewValue;
            }
        }
        public virtual void OnAutoAPKChg()
        {


        }
        #endregion 

        #region ==KSTKRS===========
        public static readonly DependencyProperty KSTKRSProperty = DependencyProperty.Register("KSTKRS",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnKSTKRSChanged));
        public string KSTKRS
        {
            get
            {
                return (string)GetValue(KSTKRSProperty);
            }
            set
            {
                SetValue(KSTKRSProperty, value);
                OnKSTKRSChg(value);
            }
        }
        private static void OnKSTKRSChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.KSTKRS = (string)e.NewValue;
            }
        }
        public virtual void OnKSTKRSChg(string value)
        { }
        #endregion

        #region ==HITAPK===========
        public static readonly DependencyProperty HITAPKProperty = DependencyProperty.Register("HITAPK",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnHITAPKChanged));
        public string HITAPK
        {
            get
            {
                return (string)GetValue(HITAPKProperty);
            }
            set
            {
                SetValue(HITAPKProperty, value);
               
            }
        }
        private static void OnHITAPKChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.HITAPK = (string)e.NewValue;
                src.OnHITAPKChg((string)e.NewValue);
            }
        }
        public virtual void OnHITAPKChg(string value)
        { }
        #endregion

        #region ==AGANG===========
        public static readonly DependencyProperty AGANGProperty = DependencyProperty.Register("AGANG",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAGANGChanged));
        public string AGANG
        {
            get
            {
                return (string)GetValue(AGANGProperty);
            }
            set
            {
                SetValue(AGANGProperty, value);
                OnAGANGChg(value);
            }
        }
        private static void OnAGANGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.AGANG = (string)e.NewValue;
            }
        }
        public virtual void OnAGANGChg(string value)
        { }
        #endregion

        #region ==APFSTATKZ===========
        public static readonly DependencyProperty APFSTATKZProperty = DependencyProperty.Register("APFSTATKZ",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFSTATKZChanged));
        public string APFSTATKZ
        {
            get
            {
                return (string)GetValue(APFSTATKZProperty);
            }
            set
            {
                SetValue(APFSTATKZProperty, value);
                OnAPFSTATKZChg();
            }
        }
        private static void OnAPFSTATKZChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFSTATKZ = (string)e.NewValue;
            }
        }
        public virtual void OnAPFSTATKZChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFSTATKZ = APFSTATKZ;
        }
        #endregion
        #region ==APFZUSTAND===========
        public static readonly DependencyProperty APFZUSTANDProperty = DependencyProperty.Register("APFZUSTAND",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSTANDChanged));
        public string APFZUSTAND
        {
            get
            {
                return (string)GetValue(APFZUSTANDProperty);
            }
            set
            {
                SetValue(APFZUSTANDProperty, value);
                OnAPFZUSTANDChg();
            }
        }
        private static void OnAPFZUSTANDChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSTAND = (string)e.NewValue;
            }
        }
        public virtual void OnAPFZUSTANDChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSTAND = APFZUSTAND;
        }
        #endregion

        #region ==APFRUECKKZ===========
        public static readonly DependencyProperty APFRUECKKZProperty = DependencyProperty.Register("APFRUECKKZ",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata(" ", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFRUECKKZChanged));
        public string APFRUECKKZ
        {
            get
            {
                return (string)GetValue(APFRUECKKZProperty);
            }
            set
            {
                SetValue(APFRUECKKZProperty, value);
                OnAPFRUECKKZChg();
            }
        }
        private static void OnAPFRUECKKZChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFRUECKKZ = (string)e.NewValue;
            }
        }
        public virtual void OnAPFRUECKKZChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFRUECKKZ = APFRUECKKZ;
        }
        #endregion

        #region ==APFMATABR===========
        public static readonly DependencyProperty APFMATABRProperty = DependencyProperty.Register("APFMATABR",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata(" ", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFMATABRChanged));
        public string APFMATABR
        {
            get
            {
                return (string)GetValue(APFMATABRProperty);
            }
            set
            {
                SetValue(APFMATABRProperty, value);
                OnAPFMATABRChg();
            }
        }
        private static void OnAPFMATABRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFMATABR = (string)e.NewValue;
            }
        }
        public virtual void OnAPFMATABRChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFMATABR = APFMATABR;
        }
        #endregion
        #region ==APFSONDERKZ===========
        public static readonly DependencyProperty APFSONDERKZProperty = DependencyProperty.Register("APFSONDERKZ",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFSONDERKZChanged));
        public string APFSONDERKZ
        {
            get
            {
                return (string)GetValue(APFSONDERKZProperty);
            }
            set
            {
                SetValue(APFSONDERKZProperty, value);
                OnAPFSONDERKZChg();
            }
        }
        private static void OnAPFSONDERKZChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFSONDERKZ = (string)e.NewValue;
            }
        }
        public virtual void OnAPFSONDERKZChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFSONDERKZ = APFSONDERKZ;
        }
        #endregion

        #region ==APFKENNUNG===========
        public static readonly DependencyProperty APFKENNUNGProperty = DependencyProperty.Register("APFKENNUNG",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("  ", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFKENNUNGChanged));
        public string APFKENNUNG
        {
            get
            {
                return (string)GetValue(APFKENNUNGProperty);
            }
            set
            {
                SetValue(APFKENNUNGProperty, value);
                OnAPFKENNUNGChg();
            }
        }
        private static void OnAPFKENNUNGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFKENNUNG = (string)e.NewValue;
            }
        }
        public virtual void OnAPFKENNUNGChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFKENNUNG = APFKENNUNG;
        }
        #endregion
        #region ==MAT===========
        public static readonly DependencyProperty MATProperty = DependencyProperty.Register("MAT",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("J", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnMATChanged));
        public string MAT
        {
            get
            {
                return (string)GetValue(MATProperty);
            }
            set
            {
                SetValue(MATProperty, value);
                OnMATChg();
            }
        }
        private static void OnMATChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.MAT = (string)e.NewValue;
            }
        }
        public virtual void OnMATChg()
        { }
        #endregion

        #region ==dwAPF===========
        public static readonly DependencyProperty dwAPFProperty = DependencyProperty.Register("dwAPF",
            typeof(DataRow), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OdwAPFChanged));
        public DataRow dwAPF
        {
            get
            {
                return (DataRow)GetValue(dwAPFProperty);
            }
            set
            {
                SetValue(dwAPFProperty, value);
            }
        }
        private static void OdwAPFChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                DataRow row = (DataRow)e.NewValue;
                src.dwAPF = row;
            }

        }
        #endregion

        #region ==APFZUSATZ===========
        public static readonly DependencyProperty APFZUSATZProperty = DependencyProperty.Register("APFZUSATZ",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZChanged));
        public string APFZUSATZ
        {
            get
            {
                return (string)GetValue(APFZUSATZProperty);
            }
            set
            {
                SetValue(APFZUSATZProperty, value);
                

            }
        }
        private static void OnAPFZUSATZChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ = (string)e.NewValue;
                src.OnAPFZUSATZChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFZUSATZChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFZUSATZ1 = value;
                    break;
                case 2:
                    TMV.APFZUSATZ2 = value;
                    break;
                case 3:
                    TMV.APFZUSATZ3 = value;
                    break;
                case 4:
                    TMV.APFZUSATZ4 = value;
                    break;
                case 5:
                    TMV.APFZUSATZ5 = value;
                    break;
            }
        }


        #endregion 

        #region ==APFNEGVERF===========
        public static readonly DependencyProperty APFNEGVERFProperty = DependencyProperty.Register("APFNEGVERF",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGVERFChanged));
        public string APFNEGVERF
        {
            get
            {
                return (string)GetValue(APFNEGVERFProperty);
            }
            set
            {
                SetValue(APFNEGVERFProperty, value);
               
            }
        }
        private static void OnAPFNEGVERFChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGVERF = (string)e.NewValue;
                src.OnAPFNEGVERFChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGVERFChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGVERF = value;
        }
        #endregion

        #region ==APFRZUSA===========
        public static readonly DependencyProperty APFRZUSAProperty = DependencyProperty.Register("APFRZUSA",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFRZUSAChanged));
        public string APFRZUSA
        {
            get
            {
                return (string)GetValue(APFRZUSAProperty);
            }
            set
            {
                SetValue(APFRZUSAProperty, value);
                
            }
        }
        private static void OnAPFRZUSAChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFRZUSA = (string)e.NewValue;
                src.OnAPFRZUSAChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFRZUSAChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFRZUSA = value;
        }
        #endregion

        #region ==APFNEGRGRP===========
        public static readonly DependencyProperty APFNEGRGRPProperty = DependencyProperty.Register("APFNEGRGRP",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGRGRPChanged));
        public string APFNEGRGRP
        {
            get
            {
                return (string)GetValue(APFNEGRGRPProperty);
            }
            set
            {
                SetValue(APFNEGRGRPProperty, value);
                
            }
        }
        private static void OnAPFNEGRGRPChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGRGRP = (string)e.NewValue;
                src.OnAPFNEGRGRPChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGRGRPChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGRGRP = value;
        }
        #endregion

        #region ==APFPZUSA===========
        public static readonly DependencyProperty APFPZUSAProperty = DependencyProperty.Register("APFPZUSA",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFPZUSAChanged));
        public string APFPZUSA
        {
            get
            {
                return (string)GetValue(APFPZUSAProperty);
            }
            set
            {
                SetValue(APFPZUSAProperty, value);
                
            }
        }
        private static void OnAPFPZUSAChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFPZUSA = (string)e.NewValue;
                src.OnAPFPZUSAChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFPZUSAChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFPZUSA = value;
        }
        #endregion


        #region ==APFRUESTGRP===========
        public static readonly DependencyProperty APFRUESTGRPProperty = DependencyProperty.Register("APFRUESTGRP",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFRUESTGRPChanged));
        public string APFRUESTGRP
        {
            get
            {
                return (string)GetValue(APFRUESTGRPProperty);
            }
            set
            {
                SetValue(APFRUESTGRPProperty, value);
                
            }
        }
        private static void OnAPFRUESTGRPChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFRUESTGRP = (string)e.NewValue;
                src.OnAPFRUESTGRPChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFRUESTGRPChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            switch(NRi)
            {
                case 1:
                    TMV.APFRUESTGRP1 = value;
                    break;
                case 2:
                    TMV.APFRUESTGRP2 = value;
                    break;
                case 3:
                    TMV.APFRUESTGRP3 = value;
                    break;
                case 4:
                    TMV.APFRUESTGRP4 = value;
                    break;
                case 5:
                    TMV.APFRUESTGRP5 = value;
                    break;
            }
         }
        #endregion


        #region ==APFSUBSTGR===========
        public static readonly DependencyProperty APFSUBSTGRProperty = DependencyProperty.Register("APFSUBSTGR",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFSUBSTGRChanged));
        public string APFSUBSTGR
        {
            get
            {
                return (string)GetValue(APFSUBSTGRProperty);
            }
            set
            {
                SetValue(APFSUBSTGRProperty, value);
              
            }
        }
        private static void OnAPFSUBSTGRChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFSUBSTGR = (string)e.NewValue;
                src.OnAPFSUBSTGRChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFSUBSTGRChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            switch (NRi)
            {
                case 1:
                    TMV.APFSUBSTGR1 = value;
                    break;
                case 2:
                    TMV.APFSUBSTGR2 = value;
                    break;
                case 3:
                    TMV.APFSUBSTGR3 = value;
                    break;
                case 4:
                    TMV.APFSUBSTGR4 = value;
                    break;
                case 5:
                    TMV.APFSUBSTGR5 = value;
                    break;
            } 
        }
        #endregion

        #region ==APFFBKL===========
        public static readonly DependencyProperty APFFBKLProperty = DependencyProperty.Register("APFFBKL",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFFBKLChanged));
        public string APFFBKL
        {
            get
            {
                return (string)GetValue(APFFBKLProperty);
            }
            set
            {
                SetValue(APFFBKLProperty, value);
               
            }
        }
        private static void OnAPFFBKLChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFFBKL = (string)e.NewValue;
                src.OnAPFFBKLChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFFBKLChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFFBKL1 = value;
                    break;
                case 2:
                    TMV.APFFBKL2 = value;
                    break;
                case 3:
                    TMV.APFFBKL3 = value;
                    break;
                case 4:
                    TMV.APFFBKL4 = value;
                    break;
                case 5:
                    TMV.APFFBKL5 = value;
                    break;
            }
        }
        #endregion


        #region ==APFNEGFBKL===========
        public static readonly DependencyProperty APFNEGFBKLProperty = DependencyProperty.Register("APFNEGFBKL",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGFBKLChanged));
        public string APFNEGFBKL
        {
            get
            {
                return (string)GetValue(APFNEGFBKLProperty);
            }
            set
            {
                SetValue(APFNEGFBKLProperty, value);
                
            }
        }
        private static void OnAPFNEGFBKLChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGFBKL = (string)e.NewValue;
                src.OnAPFNEGFBKLChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGFBKLChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGFBKL = value;
        }
        #endregion

        #region ==APFBHDLG===========
        public static readonly DependencyProperty APFBHDLGProperty = DependencyProperty.Register("APFBHDLG",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFBHDLGChanged));
        public string APFBHDLG
        {
            get
            {
                return (string)GetValue(APFBHDLGProperty);
            }
            set
            {
                SetValue(APFBHDLGProperty, value);
               
            }
        }
        private static void OnAPFBHDLGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFBHDLG = (string)e.NewValue;
                src.OnAPFBHDLGChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFBHDLGChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFBHDLG1 = value;
                    break;
                case 2:
                    TMV.APFBHDLG2 = value;
                    break;
                case 3:
                    TMV.APFBHDLG3 = value;
                    break;
                case 4:
                    TMV.APFBHDLG4 = value;
                    break;
                case 5:
                    TMV.APFBHDLG5 = value;
                    break;
            }
        }
        #endregion

        #region ==APFBHDLG2===========
        public static readonly DependencyProperty APFBHDLG2Property = DependencyProperty.Register("APFBHDLG2",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFBHDLG2Changed));
        public string APFBHDLG2
        {
            get
            {
                return (string)GetValue(APFBHDLG2Property);
            }
            set
            {
                SetValue(APFBHDLG2Property, value);
                
            }
        }
        private static void OnAPFBHDLG2Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFBHDLG2 = (string)e.NewValue;
                src.OnAPFBHDLG2Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFBHDLG2Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFBHDLG21 = value;
                    break;
                case 2:
                    TMV.APFBHDLG22 = value;
                    break;
                case 3:
                    TMV.APFBHDLG23 = value;
                    break;
                case 4:
                    TMV.APFBHDLG24 = value;
                    break;
                case 5:
                    TMV.APFBHDLG25 = value;
                    break;
            }
        }
        #endregion
        #region ==APFBHDLG3===========
        public static readonly DependencyProperty APFBHDLG3Property = DependencyProperty.Register("APFBHDLG3",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFBHDLG3Changed));
        public string APFBHDLG3
        {
            get
            {
                return (string)GetValue(APFBHDLG3Property);
            }
            set
            {
                SetValue(APFBHDLG3Property, value);
                
            }
        }
        private static void OnAPFBHDLG3Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFBHDLG3 = (string)e.NewValue;
                src.OnAPFBHDLG3Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFBHDLG3Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFBHDLG31 = value;
                    break;
                case 2:
                    TMV.APFBHDLG32 = value;
                    break;
                case 3:
                    TMV.APFBHDLG33 = value;
                    break;
                case 4:
                    TMV.APFBHDLG34 = value;
                    break;
                case 5:
                    TMV.APFBHDLG35 = value;
                    break;
            }
        }
        #endregion        
        #region ==APFBHDLG4===========
        public static readonly DependencyProperty APFBHDLG4Property = DependencyProperty.Register("APFBHDLG4",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFBHDLG4Changed));
        public string APFBHDLG4
        {
            get
            {
                return (string)GetValue(APFBHDLG4Property);
            }
            set
            {
                SetValue(APFBHDLG4Property, value);
               
            }
        }
        private static void OnAPFBHDLG4Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFBHDLG4 = (string)e.NewValue;
                src.OnAPFBHDLG4Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFBHDLG4Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return; 
            switch (NRi)
            {
                case 1:
                    TMV.APFBHDLG41 = value;
                    break;
                case 2:
                    TMV.APFBHDLG42 = value;
                    break;
                case 3:
                    TMV.APFBHDLG43 = value;
                    break;
                case 4:
                    TMV.APFBHDLG44 = value;
                    break;
                case 5:
                    TMV.APFBHDLG45 = value;
                    break;
            }
        }
        #endregion        


        #region ==APFNEGBHDLG===========
        public static readonly DependencyProperty APFNEGBHDLGProperty = DependencyProperty.Register("APFNEGBHDLG",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGBHDLGChanged));
        public string APFNEGBHDLG
        {
            get
            {
                return (string)GetValue(APFNEGBHDLGProperty);
            }
            set
            {
                SetValue(APFNEGBHDLGProperty, value);
               
            }
        }
        private static void OnAPFNEGBHDLGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGBHDLG = (string)e.NewValue;
                src.OnAPFNEGBHDLGChg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGBHDLGChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGBHDLG = value;
        }
        #endregion
        #region ==APFNEGBHDLG2===========
        public static readonly DependencyProperty APFNEGBHDLG2Property = DependencyProperty.Register("APFNEGBHDLG2",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGBHDLG2Changed));
        public string APFNEGBHDLG2
        {
            get
            {
                return (string)GetValue(APFNEGBHDLG2Property);
            }
            set
            {
                SetValue(APFNEGBHDLG2Property, value);
                
            }
        }
        private static void OnAPFNEGBHDLG2Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGBHDLG2 = (string)e.NewValue;
                src.OnAPFNEGBHDLG2Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGBHDLG2Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGBHDLG2 = value;
        }
        #endregion
        #region ==APFNEGBHDLG3===========
        public static readonly DependencyProperty APFNEGBHDLG3Property = DependencyProperty.Register("APFNEGBHDLG3",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGBHDLG3Changed));
        public string APFNEGBHDLG3
        {
            get
            {
                return (string)GetValue(APFNEGBHDLG3Property);
            }
            set
            {
                SetValue(APFNEGBHDLG3Property, value);
                
            }
        }
        private static void OnAPFNEGBHDLG3Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGBHDLG3 = (string)e.NewValue;
                src.OnAPFNEGBHDLG3Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFNEGBHDLG3Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGBHDLG3 = value;
        }
        #endregion
        #region ==APFNEGBHDLG4===========
        public static readonly DependencyProperty APFNEGBHDLG4Property = DependencyProperty.Register("APFNEGBHDLG4",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGBHDLG4Changed));
        public string APFNEGBHDLG4
        {
            get
            {
                return (string)GetValue(APFNEGBHDLG4Property);
            }
            set
            {
                SetValue(APFNEGBHDLG4Property, value);
                OnAPFNEGBHDLG4Chg();
            }
        }
        private static void OnAPFNEGBHDLG4Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGBHDLG4 = (string)e.NewValue;
            }
        }
        public virtual void OnAPFNEGBHDLG4Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGBHDLG4 = APFNEGBHDLG4;
        }
        #endregion

        #region ==APFMERK1===========
        public static readonly DependencyProperty APFMERK1Property = DependencyProperty.Register("APFMERK1",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFMERK1Changed));
        public string APFMERK1
        {
            get
            {
                return (string)GetValue(APFMERK1Property);
            }
            set
            {
                SetValue(APFMERK1Property, value); 
            }
        }
        private static void OnAPFMERK1Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFMERK1 = (string)e.NewValue;
                src.OnAPFMERK1Chg((string)e.NewValue);
            }
        }
        public virtual void OnAPFMERK1Chg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            switch (NRi)
            {
                case 1:
                    TMV.APFMERK11 = value;
                    break;
                case 2:
                    TMV.APFMERK12 = value;
                    break;
                case 3:
                    TMV.APFMERK13 = value;
                    break;
                case 4:
                    TMV.APFMERK14 = value;
                    break;
                case 5:
                    TMV.APFMERK15 = value;
                    break;
            }
        }
        #endregion

        #region ==APFNEGMERK1===========
        public static readonly DependencyProperty APFNEGMERK1Property = DependencyProperty.Register("APFNEGMERK1",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGMERK1Changed));
        public string APFNEGMERK1
        {
            get
            {
                return (string)GetValue(APFNEGMERK1Property);
            }
            set
            {
                SetValue(APFNEGMERK1Property, value);
                OnAPFNEGMERK1Chg();
            }
        }
        private static void OnAPFNEGMERK1Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGMERK1 = (string)e.NewValue;
            }
        }
        public virtual void OnAPFNEGMERK1Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGMERK1 = APFNEGMERK1;
        }
        #endregion

        #region ==APFNEGPGRP===========
        public static readonly DependencyProperty APFNEGPGRPProperty = DependencyProperty.Register("APFNEGPGRP",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGPGRPChanged));
        public string APFNEGPGRP
        {
            get
            {
                return (string)GetValue(APFNEGPGRPProperty);
            }
            set
            {
                SetValue(APFNEGPGRPProperty, value);
                OnAPFNEGPGRPChg();
            }
        }
        private static void OnAPFNEGPGRPChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGPGRP = (string)e.NewValue;
            }
        }
        public virtual void OnAPFNEGPGRPChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGPGRP = APFNEGPGRP;
        }
        #endregion

        #region ==APFGEWSCHL===========
        public static readonly DependencyProperty APFGEWSCHLProperty = DependencyProperty.Register("APFGEWSCHL",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFGEWSCHLChanged));
        public string APFGEWSCHL
        {
            get
            {
                return (string)GetValue(APFGEWSCHLProperty);
            }
            set
            {
                SetValue(APFGEWSCHLProperty, value);
                OnAPFGEWSCHLChg();
            }
        }
        private static void OnAPFGEWSCHLChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFGEWSCHL = (string)e.NewValue;
            }
        }
        public virtual void OnAPFGEWSCHLChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFGEWSCHL = APFGEWSCHL;
        }
        #endregion
        #region ==APFGEW===========
        public static readonly DependencyProperty APFGEWProperty = DependencyProperty.Register("APFGEW",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("0", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFGEWChanged));
        public string APFGEW
        {
            get
            {
                return (string)GetValue(APFGEWProperty);
            }
            set
            {
                SetValue(APFGEWProperty, value);
                
            }
        }
        private static void OnAPFGEWChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                string value = (string)e.NewValue;
                if (value == "")
                    value = "0";
                src.APFGEW = value;
                src.OnAPFGEWChg(value);
            }
        }
        public virtual void OnAPFGEWChg(string value)
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            if (NRi > 2)
                NRi = 1; 

            switch (NRi)
            {
                case 1:
                    TMV.APFGEW1 =double.Parse( value);
                    break;
                case 2:
                    TMV.APFGEW2 = double.Parse(value);
                    break; 
            }
        }
        #endregion 

        #region ==APFNEGGEW===========
        public static readonly DependencyProperty APFNEGGEWProperty = DependencyProperty.Register("APFNEGGEW",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFNEGGEWChanged));
        public string APFNEGGEW
        {
            get
            {
                return (string)GetValue(APFNEGGEWProperty);
            }
            set
            {
                SetValue(APFNEGGEWProperty, value);
                OnAPFNEGGEWChg();
            }
        }
        private static void OnAPFNEGGEWChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFNEGGEW = (string)e.NewValue;
            }
        }
        public virtual void OnAPFNEGGEWChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFNEGGEW = APFNEGGEW;
        }
        #endregion

        #region ==APFME===========
        public static readonly DependencyProperty APFMEProperty = DependencyProperty.Register("APFME",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFMEChanged));
        public string APFME
        {
            get
            {
                return (string)GetValue(APFMEProperty);
            }
            set
            {
                SetValue(APFMEProperty, value);
                OnAPFMEChg();
            }
        }
        private static void OnAPFMEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFME = (string)e.NewValue;
            }
        }
        public virtual void OnAPFMEChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFME = APFME;
        }
        #endregion

        #region ==APFZE===========
        public static readonly DependencyProperty APFZEProperty = DependencyProperty.Register("APFZE",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZEChanged));
        public string APFZE
        {
            get
            {
                return (string)GetValue(APFZEProperty);
            }
            set
            {
                SetValue(APFZEProperty, value);
                OnAPFZEChg();
            }
        }
        private static void OnAPFZEChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZE = (string)e.NewValue;
            }
        }
        public virtual void OnAPFZEChg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZE = APFZE;
        }
        #endregion

        #region ==APFZUSATZ1===========
        public static readonly DependencyProperty APFZUSATZ1Property = DependencyProperty.Register("APFZUSATZ1",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZ1Changed));
        public string APFZUSATZ1
        {
            get
            {
                return (string)GetValue(APFZUSATZ1Property);
            }
            set
            {
                SetValue(APFZUSATZ1Property, value);
                OnAPFZUSATZ1Chg();
            }
        }
        private static void OnAPFZUSATZ1Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ1 = (string)e.NewValue;
            }
        }
        public virtual void OnAPFZUSATZ1Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSATZ1 = APFZUSATZ1;
        }
        #endregion
        #region ==APFZUSATZ2===========
        public static readonly DependencyProperty APFZUSATZ2Property = DependencyProperty.Register("APFZUSATZ2",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZ2Changed));
        public string APFZUSATZ2
        {
            get
            {
                return (string)GetValue(APFZUSATZ2Property);
            }
            set
            {
                SetValue(APFZUSATZ2Property, value);
                OnAPFZUSATZ2Chg();
            }
        }
        private static void OnAPFZUSATZ2Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ2 = (string)e.NewValue;
            }
        }
        public virtual void OnAPFZUSATZ2Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSATZ2 = APFZUSATZ2;
        }
        #endregion
        #region ==APFZUSATZ3===========
        public static readonly DependencyProperty APFZUSATZ3Property = DependencyProperty.Register("APFZUSATZ3",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZ3Changed));
        public string APFZUSATZ3
        {
            get
            {
                return (string)GetValue(APFZUSATZ3Property);
            }
            set
            {
                SetValue(APFZUSATZ3Property, value);
                OnAPFZUSATZ3Chg();
            }
        }
        private static void OnAPFZUSATZ3Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ3 = (string)e.NewValue;
            }
        }
        public virtual void OnAPFZUSATZ3Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSATZ3 = APFZUSATZ3;
        }
        #endregion
        #region ==APFZUSATZ4===========
        public static readonly DependencyProperty APFZUSATZ4Property = DependencyProperty.Register("APFZUSATZ4",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZ4Changed));
        public string APFZUSATZ4
        {
            get
            {
                return (string)GetValue(APFZUSATZ4Property);
            }
            set
            {
                SetValue(APFZUSATZ4Property, value);
                
            }
        }
        private static void OnAPFZUSATZ4Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ4 = (string)e.NewValue;
                src.OnAPFZUSATZ4Chg();
            }
        }
        public virtual void OnAPFZUSATZ4Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSATZ4 = APFZUSATZ4;
        }
        #endregion
        #region ==APFZUSATZ5===========
        public static readonly DependencyProperty APFZUSATZ5Property = DependencyProperty.Register("APFZUSATZ5",
            typeof(string), typeof(UIAPFOLGE),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnAPFZUSATZ5Changed));
        public string APFZUSATZ5
        {
            get
            {
                return (string)GetValue(APFZUSATZ5Property);
            }
            set
            {
                SetValue(APFZUSATZ5Property, value);
               
            }
        }
        private static void OnAPFZUSATZ5Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UIAPFOLGE;
            if (src != null)
            {
                src.APFZUSATZ5 = (string)e.NewValue;
                src.OnAPFZUSATZ5Chg();
            }
        }
        public virtual void OnAPFZUSATZ5Chg()
        {
            if (!IsEdit)
                return;
            if (dwMaster == null)
                return;
            TMV.APFZUSATZ5 = APFZUSATZ5;
        }
        #endregion
    }

}